const express = require('express')

const app = express()




app.get('/', (req, res) => {
  // 服务器错误
  throw new Error('服务器发生错误')
  res.send('Home Page')
})

// 注册全局生效的捕获错误的中间件
app.use( (err,req, res, next)=>{
  res.send('Error'+err.message)
})

app.listen(80, () => {
  console.log('express server created  running at http://127.0.0.1');
})